class Car(val plateNumber: String, val brand: String, val color: String, val price: Double) {
  def drive(): Unit = {
    println("Driving...")
  }
  
  def park(): Unit = {
    println("Parking...")
  }
  
  def refuel(): Unit = {
    println("Refueling...")
  }
}

class ElectricCar(plateNumber: String, brand: String, color: String, price: Double,
                  val batteryCapacity: Double, var range: Double) extends Car(plateNumber, brand, color, price) {
  
  def charge(): Unit = {
    println("Charging...")
  }
  
  override def drive(): Unit = {
    if (range <= 0) {
      println("Cannot drive, out of battery!")
    } else {
      range -= 10
      println("Driving...")
    }
  }
}

// Usage example:
val car = new Car("ABC123", "Toyota", "Red", 20000)
val electricCar = new ElectricCar("DEF456", "Tesla", "Blue", 50000, 100, 80)
car.drive() // Output: Driving...
electricCar.drive() // Output: Driving...
electricCar.range = 0 // set range to 0
electricCar.drive() // Output: Cannot drive, out of battery!
electricCar.charge() // Output: Charging...
electricCar.drive() // Output: Driving...
